//
//  NavigationVC.m
//  YRMobDemo
//
//  Created by Yc on 2023/12/16.
//

#import "NavigationVC.h"
#import "Header.h"

@interface NavigationVC ()

@end

@implementation NavigationVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setupNavigationBarTitleColor:[UIColor whiteColor] barTintColor:ThemeColor translucent:NO];
}

- (void)setupNavigationBarTitleColor:(UIColor *)titleColor
                        barTintColor:(UIColor *)barTintColor
                         translucent:(BOOL)translucent {
    
    if (@available(iOS 15.0, *)) {
        UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
        [appearance configureWithOpaqueBackground];
         appearance.backgroundColor = barTintColor;//Background
        // appearance.backgroundEffect = nil; // Remove translucency effect
         appearance.shadowColor = UIColor.clearColor;
         appearance.shadowImage = [[UIImage alloc] init];
         appearance.titleTextAttributes = @{NSForegroundColorAttributeName:titleColor};//font color
         self.navigationBar.scrollEdgeAppearance = appearance; // Page with scroll sliding
         self.navigationBar.standardAppearance = appearance;//General page
    } else {

        self.navigationBar.barTintColor = barTintColor;
        [self.navigationBar setTitleTextAttributes:
         @{NSForegroundColorAttributeName:titleColor}];
    }
    [self.navigationBar setTintColor:titleColor];
    [self.navigationBar setTranslucent:translucent];
}



@end
